<!-- Buttons to add to the header. -->
<core-navbar-buttons slot="end">
    @if (!courseContentsPage) {
        <ion-button fill="clear" (click)="openModuleSummary()" aria-haspopup="true" [ariaLabel]="'core.info' | translate">
            <ion-icon name="fas-circle-info" slot="icon-only" aria-hidden="true" />
        </ion-button>
    } @else {
        <core-context-menu>
            <core-context-menu-item [priority]="5000" [content]="'core.info' | translate" (action)="openModuleSummary()"
                iconAction="fas-circle-info" />
        </core-context-menu>
    }
</core-navbar-buttons>

<!-- Content. -->
<core-loading [hideUntil]="!showLoading">

    <!-- Activity info. -->
    <core-course-module-info [module]="module" [description]="displayDescription && description" [component]="component"
        [componentId]="componentId" [courseId]="courseId" (completionChanged)="onCompletionChange()" />

    @if (url) {
        @if (shouldIframe || (shouldEmbed && isOther)) {
            <div class="addon-mod_url-embedded-url">
                <core-iframe [src]="url" />
            </div>
        } @else {
            <ion-list>
                @if (shouldEmbed) {
                    <ion-item>
                        <ion-label>
                            @if (isImage) {
                                <img [alt]="name" [src]="embeddedUrl">
                            } @else if (isVideo) {
                                <video [title]="name" controls controlsList="nodownload">
                                    <source [src]="embeddedUrl" [type]="mimetype">
                                </video>
                            } @else if (isAudio) {
                                <audio [title]="name" controls>
                                    <source [src]="embeddedUrl" [type]="mimetype">
                                </audio>
                            }
                        </ion-label>
                    </ion-item>
                }
                <ion-item class="ion-text-wrap">
                    <ion-label>
                        <p class="item-heading">{{ 'addon.mod_url.pointingtourl' | translate }}</p>
                        <p>{{ url }}</p>
                    </ion-label>
                </ion-item>
            </ion-list>
        }
    }

    @if (!showLoading) {
        <div collapsible-footer appearOnBottom slot="fixed">
            @if (url && !shouldIframe && (!shouldEmbed || !isOther)) {
                <div class="list-item-limited-width">
                    <ion-button expand="block" (click)="go()" class="ion-margin ion-text-wrap">
                        <ion-icon name="fas-link" slot="start" aria-hidden="true" />
                        {{ 'addon.mod_url.accessurl' | translate }}
                    </ion-button>
                </div>
            }
            <core-course-module-navigation [courseId]="courseId" [currentModuleId]="module.id" />
        </div>
    }
</core-loading>
